<@t.html>
	<@t.container title="添加友链" icon="link" back="true" >
				<@t.form id="add_form">
					<#if bean??>
        				<input type="hidden" id="id" name="id" value="${bean.id}"/>	
					</#if>
                	<@t.select title="友链类型" id="type" datas={"1":"文字", "2":"图片"} defaultValue="${bean.type!''}" />
					<@t.text title="链接" id="url" value="${bean.url!''}" />    
					<@t.text title="链接名称" id="name" value="${bean.name!''}" />    
                	<@t.uploader title="logo图片" id="logo" value="${bean.logo!''}" help="上传200*200以上（尺寸比例为1：1）" />
					<@t.submitBtn title="保存"/>
               </@t.form>
	</@t.container>
 <script type="text/javascript">
     $(function(){
     	//绑定上传
         $('#logo').uploadify({'params':{'channel':'link_logo'},'allow':'*.jpg;*.png;*.gif'});
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "name": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写名称",
        	            msg: {
        	            	required: "名称不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
               $ .axsf('admin/link/add',data,function(d){
			   		if(d){
                         if(d.code==200){
							window.location.href="admin/link/index";
                         }else{
						 	alert(d.message);
						 }
                	}
			   });
        });
});
</script>
</@t.html>